import React, {Component} from 'react'
import {Link} from 'react-router'
import './nav.scss'
import { Menu, Icon } from 'antd';


 class NavComponent extends Component{
    constructor(props){
            super(props);

    }
    toggleNav(){
       // console.log(this)
    }
    toggleNavItem(){

    }
    handleClick(e) {

      const  jumpText = e.item.props.children
      // console.log(jumpText)
      switch (jumpText){
          case "被举报问题":
            this.props.options.childProps.router.push({pathname: '/home/report-question'});
            break;
          case '已开放问题':
            this.props.options.childProps.router.push({pathname: '/home/open-question'});
            break;
          case '已屏蔽问题':
            this.props.options.childProps.router.push({pathname: '/home/close-question'});
            break;
          case '新增加问题':
            this.props.options.childProps.router.push({pathname: '/home/add-question'});
            break;
          case '被举报回答':
            this.props.options.childProps.router.push({pathname: '/home/report-answer'});
            break;
          case '已开放回答':
            this.props.options.childProps.router.push({pathname: '/home/open-answer'});
            break;
          case '已屏蔽回答':
            this.props.options.childProps.router.push({pathname: '/home/close-answer'});
            break;
      }

      // if(jumpText ==="被举报问题" ){
      //       this.props.options.childProps.router.push({pathname: '/home/rqc'})
      // }else{

      // }
    }
    render(){

        // console.log(this.props.options.childProps)
        const SubMenu = Menu.SubMenu;
        const MenuItemGroup = Menu.ItemGroup;
        return (
            <div className="cm-nav-content" ref="cmnav"  onClick={this.toggleNav.bind(this)}>
                <Menu onClick={this.handleClick.bind(this)} style={{ width: 160 }} mode="vertical">

                   <SubMenu key="sub1" title={<span><Icon type="mail" /><span>问答管理</span></span>}>
                     <Menu.Item key="1">被举报问题</Menu.Item>
                     <Menu.Item key="2">已开放问题</Menu.Item>
                     <Menu.Item key="3">已屏蔽问题</Menu.Item>
                     <Menu.Item key="4">新增加问题</Menu.Item>
                     <Menu.Item key="5">被举报回答</Menu.Item>
                     <Menu.Item key="6">已开放回答</Menu.Item>
                     <Menu.Item key="7">已屏蔽回答</Menu.Item>
                   </SubMenu>

                   <SubMenu key="sub2" title={<span><Icon type="form" /><span>评论管理</span></span>}>
                     <Menu.Item key="8">文章评论列表</Menu.Item>
                     <Menu.Item key="9">问题评论列表</Menu.Item>
                   </SubMenu>

                   <SubMenu key="sub3" title={<span><Icon type="book" /><span>文章管理</span></span>}>
                     <Menu.Item key="10">文章列表</Menu.Item>
                   </SubMenu>

                   <SubMenu key="sub4" title={<span><Icon type="message" /><span>话题管理</span></span>}>
                     <Menu.Item key="11">话题列表</Menu.Item>
                     <Menu.Item key="12">用户申请话题</Menu.Item>
                   </SubMenu>

                   <SubMenu key="sub5" title={<span><Icon type="appstore" /><span>内容管理</span></span>}>
                     <Menu.Item key="13">社区推荐回答</Menu.Item>
                     <Menu.Item key="14">社区推荐话题</Menu.Item>
                     <Menu.Item key="15">首页广告图</Menu.Item>
                     <Menu.Item key="16">精选文章列表</Menu.Item>
                     <Menu.Item key="17">精选问题列表</Menu.Item>
                   </SubMenu>
                 </Menu>

           </div>
        )
    }
}

export default NavComponent

